package com.algorithm.fifty2onehundred;

/**
 * @author: tzj
 * @create: 2021-05-31
 **/
public class LengthOfLastWord_58 {

    public static void main(String[] args) {
        // Hello World
        String s = "Hello World";
        System.out.println(lengthOfLastWord(s));
    }

    public static int lengthOfLastWord(String s) {
        String[] arr = s.split(" ");
        int len = arr.length;
        if (len==0) {
            return 0;
        }
        return arr[len-1].length();
    }
}
